﻿using Newtonsoft.Json.Linq;

namespace NetEasyMusic.Lib.Models;

public class PlaylistModel
{
    public string Id { get; init; } = "";
    public string Name { get; set; } = "";
    public string CoverImgUrl { get; set; } = "";
    public string Description { get; init; } = "";

    public PlaylistModel()
    {
        
    }

    public PlaylistModel(JToken token)
    {
        Id = token["id"]!.ToObject<string>()!;
        Name = token["name"]!.ToObject<string>()!;
        CoverImgUrl = token["picUrl"]?.ToObject<string>()!;
        if (string.IsNullOrEmpty(CoverImgUrl))
            CoverImgUrl = token["coverImgUrl"]?.ToObject<string>()!;
    }
}